package cn.gov.anhai.utils;

import org.springframework.expression.spel.ast.NullLiteral;
import sun.text.resources.zh.JavaTimeSupplementary_zh;

/**
 * 分页工具类
 */
public class PageUtil {
    private Integer current;
    private Integer size;

    public PageUtil() {

    }

    /**
     * 实例化分页工具对象
     *
     * @param current 当前页码（从1开始）
     * @param size    每个条数
     */
    public PageUtil(Integer current, Integer size) {
        this.current = current;
        this.size = size;
    }

    /**
     * 分页开始位置
     */
    public Integer getOffset() {
        if (current == null || size == null) return null;
        return (current - 1) * size;
    }

    /**
     * 分页条数
     */
    public Integer getRow() {
        return size;
    }
}
